# -*- coding:utf-8 -*-
import os

env = os.environ.get("APIENV", "test")

# ####################
# api 相关配置信息
# 1. 平台key配置
# 2. 平台Rest配置
# 3. 平台名配置
# ####################

SWITCH_TIMES = False

# ####################
# 缓存中所有的keys
# ####################
EXCHANGE_SUB_KEYS = "ws:exchange:sub:keys"


# ####################
# XT当前版本合约
# ####################
XT_V3_FUTURE_NAME = "xtv3future"
if env == "test":
    XT_V3_FUTURE_DOMAIN = "https://fapi.xt.com"
elif env == "pro":
    XT_V3_FUTURE_DOMAIN = "https://fapi.xt.com"
else:
    XT_V3_FUTURE_DOMAIN = "https://fapi.xt.com"
XT_V3_FUTURE_URI = XT_V3_FUTURE_DOMAIN + "/future/market/v1/public/symbol/list"
XT_V3_FUTURE_TICKER_URI = XT_V3_FUTURE_DOMAIN + '/data/api/v1/getTickers'
XT_V3_FUTURE_RETAIN_URI = XT_V3_FUTURE_DOMAIN + \
    "/future/market/v1/public/symbol/list"
XT_V3_FUTURE_FORMAT_KEY = "{}:markets".format(XT_V3_FUTURE_NAME)
XT_V3_FUTURE_BALCKLIST_KEY = "xtv3future:markets:blacklist"
XT_V3_FUTURE_SUBSCRIBE_PREIFX_KEY = r"xtv3future:markets:recover:*"


# ####################
# FTX当前版本现货
# ####################
FTX_LATEST_SPOT_NAME = "ftx"
FTX_LATEST_SPOT_URI = "https://ftx.com/api/markets"
FTX_LATEST_SPOT_TICKER_URI = ''
FTX_LATEST_SPOT_RETAIN_URI = "https://ftx.com/api/markets"
FTX_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(FTX_LATEST_SPOT_NAME)
FTX_LATEST_SPOT_BALCKLIST_KEY = "ftx:markets:blacklist"
FTX_LATEST_SPOT_SUBSCRIBE_PREIFX_KEY = r"ftx:markets:recover:*"


# ####################
# MXC当前版本现货
# ####################
MXC_LATEST_SPOT_NAME = "mxc"
MXC_LATEST_SPOT_URI = "https://www.mxc.com/open/api/v2/market/symbols"
MXC_LATEST_SPOT_RETAIN_URI = "https://www.mxc.com/open/api/v2/market/symbols"
MXC_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(MXC_LATEST_SPOT_NAME)
MXC_LATEST_SPOT_BALCKLIST_KEY = "mxc:markets:blacklist"
MXC_LATEST_SPOT_SUBSCRIBE_PREIFX_KEY = r"mxc:markets:recover:*"


# ####################
# Bitfinex当前版本现货
# ####################
BITFINEX_LATEST_SPOT_NAME = "bitfinex"
BITFINEX_LATEST_SPOT_URI = "https://api.bitfinex.com/v1/symbols"
BITFINEX_LATEST_SPOT_RETAIN_URI = "https://api.bitfinex.com/v1/symbols"
BITFINEX_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(
    BITFINEX_LATEST_SPOT_NAME)
BITFINEX_LATEST_SPOT_BALCKLIST_KEY = "bitfinex:markets:blacklist"
BITFINEX_LATEST_SPOT_SUBSCRIBE_PREIFX_KEY = r"bitfinex:markets:recover:*"


# ####################
# Okex当前版本现货
# ####################
OKEX_LATEST_SPOT_NAME = "okex"
OKEX_LATEST_SPOT_URI = "https://www.okex.com/api/v5/public/instruments?instType=SPOT"
OKEX_LATEST_SPOT_RETAIN_URI = "https://www.okex.com/api/v5/public/instruments?instType=SPOT"
OKEX_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(OKEX_LATEST_SPOT_NAME)
OKEX_LATEST_SPOT_BALCKLIST_KEY = "okex:markets:blacklist"
OKEX_LATEST_SPOT_SUBSCRIBE_PREIFX_KEY = r"okex:markets:recover:*"


# ####################
# Gate当前版本现货
# ####################
GATE_LATEST_SPOT_NAME = "gate"
GATE_LATEST_SPOT_URI = "http://data.gateio.io/api2/1/marketlist"
GATE_LATEST_SPOT_RETAIN_URI = "http://data.gateio.io/api2/1/marketinfo"
GATE_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(GATE_LATEST_SPOT_NAME)
GATE_LATEST_SPOT_BALCKLIST_KEY = "gate:markets:blacklist"
GATE_LATEST_SPOT_SUBSCRIBE_PREIFX_KEY = r"gate:markets:recover:*"


# ####################
# Zb当前版本现货
# ####################
ZB_LATEST_SPOT_NAME = "zb"
ZB_LATEST_SPOT_URI = "https://api.zb.land/data/v1/markets"
ZB_LATEST_SPOT_RETAIN_URI = "https://api.zb.team/data/v1/markets"
ZB_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(ZB_LATEST_SPOT_NAME)
ZB_LATEST_SPOT_BALCKLIST_KEY = "zb:markets:blacklist"
ZB_LATEST_SPOT_SUBSCRIBE_PREIFX_KEY = r"zb:markets:recover:*"


# ####################
# Binance当前版本现货
# ####################
BINANCE_LATEST_SPOT_NAME = "binance"
BINANCE_LATEST_SPOT_URI = "https://api.binance.com/api/v3/exchangeInfo"
BINANCE_LATEST_SPOT_TICKER_URI = ''
BINANCE_LATEST_SPOT_RETAIN_URI = "https://api.binance.com/api/v3/exchangeInfo"
BINANCE_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(BINANCE_LATEST_SPOT_NAME)
BINANCE_LATEST_SPOT_BALCKLIST_KEY = "binance:markets:blacklist"
BINANCE_LATEST_SPOT_SUBSCRIBE_PREIFX_KEY = r"binance:markets:recover:*"


# ####################
# HuoBi当前版本现货
# ####################
HUOBI_LATEST_SPOT_NAME = "huobi"
HUOBI_LATEST_SPOT_URI = "https://api.huobi.pro/v1/common/symbols"
HUOBI_LATEST_SPOT_RETAIN_URI = "https://api.huobi.pro/v1/common/symbols"
HUOBI_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(HUOBI_LATEST_SPOT_NAME)
HUOBI_LATEST_SPOT_BALCKLIST_KEY = "huobi:markets:blacklist"
HUOBI_LATEST_SPOT_SUBSCRIBE_PREIFX_KEY = r"huobi:markets:recover:*"

# ####################
# XTv4Spot当前版本现货
# ####################
XTV4SPOT_LATEST_SPOT_NAME = "xtv4spot"
if env == "test":
    XTV4SPOT_LATEST_DOMAIN = "http://sapi.xt-uat.com"
elif env == "pro":
    XTV4SPOT_LATEST_DOMAIN = "https://sapi.xt.com"
else:
    XTV4SPOT_LATEST_DOMAIN = "http://sapi.xt-uat.com"
XTV4SPOT_LATEST_SPOT_URI = XTV4SPOT_LATEST_DOMAIN + "/v4/public/symbol"
XTV4SPOT_LATEST_SPOT_TICKER_URI = XTV4SPOT_LATEST_DOMAIN + '/v4/public/ticker/price'
XTV4SPOT_LATEST_SPOT_RETAIN_URI = XTV4SPOT_LATEST_DOMAIN + "/v4/public/symbol"
XTV4SPOT_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(
    XTV4SPOT_LATEST_SPOT_NAME)
XTV4SPOT_LATEST_SPOT_BALCKLIST_KEY = "xtv4spot:markets:blacklist"
XTV4SPOT_LATEST_SPOT_SUBSCRIBE_PREIFX_KEY = r"xtv4spot:markets:recover:*"


# ####################
# Xt当前版本现货
# ####################
XT_LATEST_SPOT_NAME = "xt"
if env == "test":
    XT_LATEST_DOMAIN = "http://sapi.xt-uat.com"
elif env == "pro":
    XT_LATEST_DOMAIN = "https://sapi.xt.com"
else:
    XT_LATEST_DOMAIN = "http://sapi.xt-uat.com"
XT_LATEST_SPOT_URI = XT_LATEST_DOMAIN + "/v4/public/symbol"
XT_LATEST_SPOT_TICKER_URI = XT_LATEST_DOMAIN + '/v4/public/ticker/price'
XT_LATEST_SPOT_RETAIN_URI = XT_LATEST_DOMAIN + "/v4/public/symbol"
XT_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(XT_LATEST_SPOT_NAME)
XT_LATEST_SPOT_BALCKLIST_KEY = "xt:markets:blacklist"
XT_LATEST_SPOT_SUBSCRIBE_PREIFX_KEY = r"xt:markets:recover:*"


# ####################
# Plat
# ####################
PLAT_LATEST_SPOT_NAME = "xt"
PLAT_LATEST_SPOT_FORMAT_KEY = "{}:markets".format(PLAT_LATEST_SPOT_NAME)
PLAT_LATEST_SPOT_FORMAT_TICKER_KEY = "{}:tickers".format(PLAT_LATEST_SPOT_NAME)
PLAT_LATEST_SPOT_FORMAT_EXCHANGE_KEY = 'xt:exchange:{}:{}'
PLAT_LATEST_SPOT_FORMAT_CONFIG_KEY = "{}:markets:{}:config"
